#include "lcd.h"
#include "common.h"

#define LCD_FONT_8PIX 0
#define LCD_FONT_16PIX 1
#define LINE_WIDTH (LCD_WIDTH/font_width)
#define ASCII_OFFSET 0x20
#define ASCII_MAX 0xEF

// initialize lcd. Must be called before any use of other lcd_* functions
void lcd_init(void);
// set font with given height and width to font
unsigned char lcd_setfont(unsigned char* font, unsigned char height, unsigned char width);
// get height and width of dislay in symbol places
unsigned char lcd_gettextheight(void);
unsigned char lcd_gettextwidth(void);
// write an alphanumeric symbol to position pos. Position 0 is upper left corner of the display
unsigned char lcd_writechar(unsigned char pos, unsigned char character);
// write a text buf of length len containing only alphanumeric symbols to position pos. Position 0 is upper left corner of the display
unsigned char lcd_writetext(unsigned char pos, unsigned char len, unsigned char* buf);
// scroll 1 line down
void lcd_scrolldown(void);
// read status of controller con
unsigned char lcd_status(unsigned char con);
// set parameters of both controllers
inline void lcd_onoff(unsigned char onoff);
inline void lcd_adc(unsigned char inv);
inline void lcd_stdrive(unsigned char onoff);
inline void lcd_duty(unsigned char duty);
inline void lcd_setstring(unsigned char n);
inline void lcd_setpage(unsigned char page);
// clear lcd 
void lcd_clear(unsigned char color);
// set column on controller side to col
void lcd_setcol(unsigned char side, unsigned char col);
// write byte of data to controller side
void lcd_writebyte(unsigned char side, unsigned char byte);
// read byte of data from controller side
unsigned char lcd_readbyte(unsigned char side);